<?php
class Mission
{
	var $iID;
	var $sTodo;
	var $iStatus;
	var $iRequester;
	var $iGroup;
	var $iUrgency;
	var $iRequestTime;
	var $iAssignTime;
	var $iFinishTime;
	var $sRequestID;
	var $iUsers = array();
	var $oNotes;
	var $oLog;
	var $iTotalwork;
	var $oWork;
	var $iNoteCount;
	var $iFileCount;
	
	function Mission($iNewID, $sNewTodo, $iNewStatus, $iNewRequester, $iNewGroup, $iNewUrgency, $iNewRequestTime, $iNewAssignTime, $iNewFinishTime, $sNewRequestID, $iNewUsers, $iNewTotalwork, $iNoteCount, $iFileCount)
	{
		$this->iID = $iNewID;
		$this->sTodo = $sNewTodo;
		$this->iStatus = $iNewStatus;
		$this->iRequester = $iNewRequester;
		$this->iGroup = $iNewGroup;
		$this->iUrgency = $iNewUrgency;
		$this->iRequestTime = $iNewRequestTime;
		$this->iAssignTime = $iNewAssignTime;
		$this->iFinishTime = $iNewFinishTime;
		$this->sRequestID = $sNewRequestID;
		if (is_array($iNewUsers))
		{
			$this->iUsers = $iNewUsers;
		}
		$this->iTotalwork = $iNewTotalwork;
		$this->iNoteCount = (int)$iNoteCount;
		$this->iFileCount = (int)$iFileCount;
	}

	function getNotes()
	{
		return $this->oNotes = NoteHandler::getNotes($_SESSION['iJobID'], $this->iID);
	}

	function getLog()
	{
		if (!is_array($this->oLog))
			$this->oLog = MissionHandler::getLog($this->iID);

		return $this->oLog;
	}

	function getWork()
	{
		if (!is_array($this->oWork))
			$this->oWork = MissionHandler::getWork($this->iID);

		return $this->oWork;
	}

	function getMinimissions()
	{
		return UMinimissionHandler::getMinimissions($this->iID);
	}
}
?>
